<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.剩余参数必须是最后一个参数
        // 2.剩余参数必须是函数的最后一个参数
        function getItems(fruitList, ...args, favoriteFruit) {
            return [...fruitList, ...args, favoriteFruit]
        }
        getItems(["banana", "apple"], "pear", "orange")
    </script>
</body>

</html>